package h2UDPtest;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class Receive {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds=new DatagramSocket(10086);
        while (true) {
            byte[] byts = new byte[1024];
            DatagramPacket dp = new DatagramPacket(byts, byts.length);
            ds.receive(dp);

            System.out.println("数据是"+new java.lang.String(dp.getData(), 0, dp.getLength()));
        }
    }
}
